#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
检查测试跳过的原因
"""

from tests.utils.excel_reader import get_excel_test_data_reader

def check_skip_reasons():
    """检查测试跳过的原因"""
    reader = get_excel_test_data_reader()
    
    print("=== 检查POST用户创建测试用例 ===")
    post_cases = reader.read_test_cases_by_method('POST', '用户创建测试')
    print(f"找到 {len(post_cases)} 个POST测试用例")
    
    for i, case in enumerate(post_cases[:6]):
        test_id = case.get('test_case_id', 'unknown')
        is_valid = reader.validate_test_case(case)
        print(f"TC{i+1}: {test_id}, 验证结果: {is_valid}")
        
        if not is_valid:
            print(f"  - 缺失字段检查:")
            required_fields = ['test_case_id', 'test_name', 'api_method', 'api_path', 'expected_status_code']
            for field in required_fields:
                value = case.get(field)
                if not value or (isinstance(value, str) and value.strip() == ''):
                    print(f"    * {field}: 缺失或为空")
                else:
                    print(f"    * {field}: {value}")
    
    print("\n=== 检查GET用户查询测试用例 ===")
    get_cases = reader.read_test_cases_by_method('GET', '用户查询测试')
    print(f"找到 {len(get_cases)} 个GET测试用例")
    
    for i, case in enumerate(get_cases[:3]):
        test_id = case.get('test_case_id', 'unknown')
        is_valid = reader.validate_test_case(case)
        print(f"TC{i+1}: {test_id}, 验证结果: {is_valid}")
    
    print("\n=== 检查系统接口测试用例 ===")
    system_cases = reader.read_test_cases_by_method('GET', '系统接口测试')
    print(f"找到 {len(system_cases)} 个系统接口测试用例")
    
    for i, case in enumerate(system_cases[:3]):
        test_id = case.get('test_case_id', 'unknown')
        is_valid = reader.validate_test_case(case)
        print(f"TC{i+1}: {test_id}, 验证结果: {is_valid}")

if __name__ == "__main__":
    check_skip_reasons()